<template>
<!--  工作进度报告-->
  <div class="jdbg">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="60px">
      <el-row style="margin-top: 25px">
        <el-col :span="6">
          <el-form-item label="报告人：" label-width="90px">
            <el-input v-model="ruleForm.reporter" placeholder="请输入" suffix-icon="el-icon-user" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="报告日期：" label-width="90px">
            <el-date-picker
              v-model="ruleForm.date"
              type="date"
              placeholder="选择日期"
              style="width: 100%"
              :readonly="status==='read'">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="报告部门：" label-width="90px">
            <el-input v-model="ruleForm.bumen" placeholder="请输入" suffix-icon="el-icon-c-scale-to-original" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="N：">
            <el-input v-model="ruleForm.N" placeholder="请输入" :readonly="status==='read'" ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-form-item label="报告单位：" label-width="90px">
          <el-input v-model="ruleForm.unit" placeholder="请输入" suffix-icon="el-icon-office-building" :readonly="status==='read'"></el-input>
        </el-form-item>
      </el-row>
      <div class="form-small-title">
        <el-divider direction="vertical" class="form-divider"></el-divider>
        <span class="form-small-font">基本信息</span>
      </div>
      <el-row style="margin-top: 25px">
        <el-col :span="12">
          <el-form-item label="项目名称：" label-width="90px">
            <el-input v-model="ruleForm.projectName" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="报告类型：" label-width="90px">
            <el-select v-model="ruleForm.type" placeholder="请选择" :disabled="status==='read'">
              <el-option v-for="item in reportTypesOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="工时合计：" label-width="90px">
            <el-input v-model="ruleForm.workHour" placeholder="请输入" :readonly="status==='read'">
              <template slot="append">时</template>
            </el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="项目编号：" label-width="90px">
            <el-input v-model="ruleForm.xmbh" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="项目进度：" label-width="90px">
            <el-input v-model="ruleForm.xmjd" placeholder="请输入" :readonly="status==='read'">
              <template slot="append">%</template>
            </el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="开始日期：" label-width="90px">
            <el-date-picker
              v-model="ruleForm.jhks"
              type="date"
              placeholder="选择日期"
              style="width: 100%"
              :readonly="status==='read'">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="完成日期：" label-width="90px">
            <el-date-picker
              v-model="ruleForm.jhwc"
              type="date"
              placeholder="选择日期"
              style="width: 100%"
              :readonly="status==='read'" >
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="报告内容：" label-width="90px">
            <el-input v-model="ruleForm.bgnr" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <div class="form-small-title">
        <el-divider direction="vertical" class="form-divider"></el-divider>
        <span class="form-small-font">任务进度</span>
      </div>
    </el-form>
    <form-table tableState="jdbg" :tableColumns="tableColumns" :tableData="tableData" :defaultData="defaultData" :status="status"></form-table>
  </div>
</template>

<script>
import FormTable from "@/views/leader/components/formTable";
export default {
  name: "jdbg",
  components: {FormTable},
  data(){
    return{
      ruleForm:{},
      rules:{},
      reportTypesOptions:[],
      tableColumns:[
        {prop: 'rwmc', label: '任务名称', align: 'center',type:'input'},
        {prop: 'trgs', label: '投入工时', align: 'center',type:'input'},
        {prop: 'wcb', label: '完成比', align: 'center',type:'input'},
        {label: '开始日期', align: 'center',children:[
            {prop: 'jhks', label: '计划开始', align: 'center',type:'date'},
            {prop: 'sjks', label: '实际开始', align: 'center',type:'date'},
          ]
        },
        {label: '结束日期', align: 'center',children:[
            {prop: 'jhwc', label: '计划完成', align: 'center',type:'date'},
            {prop: 'sjwc', label: '实际完成', align: 'center',type:'date'},
          ]
        },
        {prop: 'sjgq', label: '实际工期', align: 'center',type:'input'},
        {prop: 'cgwj', label: '成果文件', align: 'center',type:'input'},
      ],
      tableData:[],
      defaultData:['rwmc','trgs','wcb','jhks','sjks','jhwc','sjwc','sjgq','cgwj']
    }
  },
  props:{
    status:{
      type: String,
      default: ''
    },
    selectRow:{
      type: Object,
      default: ()=>{}
    }
  },
  watch:{
    selectRow:{
      handler(val) {
        if(this.selectRow){
          this.ruleForm.projectName = this.selectRow.projectName
          this.ruleForm.xmjd = this.selectRow.schedule
          this.ruleForm.reporter = this.selectRow.reporter
          this.ruleForm.date = this.selectRow.date
          this.ruleForm.type = this.selectRow.type
          this.ruleForm.workHour = this.selectRow.workHour
        }
      },
      immediate: true,
    }
  }
}
</script>

<style scoped lang="scss">
.jdbg ::v-deep{
  .el-input__inner {
    border: 0 !important;
    border-bottom: 1px solid #DCDFE6 !important;
    border-radius: 0 !important;
    padding-right: 20px !important;
  }
}
.form-small-title{
  border-bottom: solid 2px #C0C4CC;
  padding-bottom: 10px;
}
.form-divider{
  width: 5px;
  height: 26px;
  background: rgb(66, 185, 131);
}
.form-small-font{
  font-size: 19px;
  font-weight: 600;
  color: #303133;
}
</style>
